package com.szrt.java.day20170103.interfaceClassTest.Cal;

import java.util.Arrays;

public class CalDaoImpl implements CalDao{

	@Override
	public int add(int x, int y) {
		System.out.println("x+"+"y="+(x+y));
		return x+y;
	}

	@Override
	public int sub(int x, int y) {
		System.out.println("x-"+"y="+(x-y));
		return x-y;
	}

	@Override
	public double mul(double x, double y) {
		System.out.println("x*"+"y="+(x*y));
		return x*y;
	}

	@Override
	public double divi(double x, double y) {
		System.out.println("x/"+"y="+(x/y));
		return x/y;
	}

	@Override
	public int addM(int... args) {
		int sum = 0;
		for(int i =0;i<args.length;i++){
			sum = sum+args[i];
		}
		
		/*for(int sum:args){
			sum = sum+args[i];
		}*/
		System.out.println(Arrays.toString(args)+"求和得："+sum);
		return sum;
	}

	

}
